using System.Collections.Generic;
using Microsoft.Practices.CompositeUI.UIElements;

namespace OrdersManager.Module.Tests.Mocks
{
	public class MockUIElementAdapterFactoryCatalog : IUIElementAdapterFactoryCatalog
	{
		private List<IUIElementAdapterFactory> _factories = new List<IUIElementAdapterFactory>();

		public IList<IUIElementAdapterFactory> Factories
		{
			get { return _factories.AsReadOnly(); }
		}

		public IUIElementAdapterFactory GetFactory(object element)
		{
			if (_factories.Count > 0)
				return _factories[0];
			return null;
		}

		public void RegisterFactory(IUIElementAdapterFactory factory)
		{
			_factories.Add(factory);
		}
	}
}